import { TreeSelect } from 'antd';
import React, { useState } from 'react';
const { SHOW_PARENT } = TreeSelect;
var treeData = [
  {
    title: '锅炉运行状态',
    value: 'option1',
    children: [
      {
        title: '锅炉启炉',
        value: 'eqpt_fur_up',
      },
      {
        title: '锅炉运行',
        value: 'eqpt_fur_run',
      },
      {
        title: '锅炉停运',
        value: 'eqpt_fur_stop',
      },
      {
        title: '锅炉预启炉',
        value: 'eqpt_fur_ready_up',
      },
      {
        title: '锅炉预停运',
        value: 'eqpt_fur_ready_stop',
      },
    ],
  },
  {
    title: '汽机运行状态',
    value: 'option2',
    children: [
      {
        title: '汽机停机',
        value: 'eqpt_stmtub_halt',
      },
      {
        title: '汽机运行',
        value: 'eqpt_stmtub_start',
      },
    ],
  },
];
const App = () => {
  const [value, setValue] = useState(['0-0-0']);
  const onChange = newValue => {
    console.log('onChange ', value);
    setValue(newValue);
  };
  const tProps = {
    treeData,
    value,
    onChange,
    treeCheckable: true,
    showCheckedStrategy: SHOW_PARENT,
    placeholder: '请选择',
    style: {
      width: '100%',
    },
  };
  return <TreeSelect {...tProps} style={{ width: 300, margin: 200 }} />;
};
export default App;
